<?php
class template_detail extends theme
{
	
	protected function head()
	{
	?>
<!--[if IE]>
<script type="text/javascript" language="javascript" src="js/excanvas.compiled.js"></script>
<![endif]-->
<script type="text/javascript" language="javascript" src="js/jquery.bt.min.js"></script>

<link type="text/css" rel="stylesheet" href="templates/pricing/css/detail.css">
<script type="text/javascript" language="javascript" src="templates/pricing/js/detail.js"></script>
	<?php
	}

	protected function center()
	{
		$pricing = $this->get('pricing');
		?>
<div class="center-title">客户信息</div>
<div class="center-content">

<?php $this->message();?>

	<div class="creater">
		<?php
		if($pricing->customer_id)
		{
		$customer = bone::get_user($pricing->customer_id);
		?>
		<div class="avatar"><img src="storage/avatar/large_<?php echo $customer->avatar; ?>" /></div>
		<div class="name"><?php echo $customer->name; ?></div>
		<?php
		}
		else
		{
		?>
		<div class="avatar"><img src="storage/avatar/large_0.jpg" /></div>
		<div class="name">游客</div>	
		<?php
		}
		?>
		<div class="time"><?php echo date('Y-m-d H:i', $pricing->create_time); ?></div>
		 
	</div>
	
	<div class="detail">
	
		<div class="name"><?php echo $pricing->name; ?></div>
		<div class="description"><?php echo $pricing->description; ?></div>
	
		<div class="attachments">
		<div class="title">附件:</div>
		<ul>
		<?php
		if(count($this->get('attachments')))
		{
		foreach($this->get('attachments') as $attachment)
		{
		$size = $attachment->size;
		if($size>1048576)
			$size = number_format($size/1048576,2).' MB';
		else if($size>1024)
			$size = intval($size/1024).' KB';
		else
			$size = $size.' B';
		?>
		<li><img src="images/ext/<?php echo $attachment->type; ?>.png" align="absmiddle" /> &nbsp;<?php echo $attachment->name; ?> &nbsp;<span style="color:#aaa;">(<?php echo $size; ?>)</span> </li>
		<?php
		}
		}
		else
		{
			echo '<li>没有附件</li>';
		}
		?>
		</ul>
		</div>
		
	</div>
	
	<div class="clr"></div>
</div>


<div class="center-title">报价信息</div>
<div class="center-content">

<?php
if($pricing->priced)
{
$manager = $this->get('manager');
$t = time();
$is_online = ($t-$manager->beat_time)<660;
?>
<div class="manager">
	<div title="<?php echo $manager->description; ?>" class="avatar">
	<a href="<?php echo url('./?controller=team&task=user_detail&user_id='.$user->id.'&menu_id=13' ); ?>" target="_blank">
	<img src="storage/avatar/large_<?php echo $manager->avatar; ?>" border="0" alt="<?php echo $manager->name; ?>" />
	</a>
	</div>
	<div class="name">
		<a href="<?php echo url('./?controller=team&task=user_detail&user_id='.$manager->id.'&menu_id=13' ); ?>" target="_blank" title="点击查看开发团队成员 <?php echo $manager->name; ?> 资料">
		<?php echo $manager->name; ?>
		</a>&nbsp;
		<img src="images/icon_<?php echo $is_online?'online':'offline' ?>.gif" border="0" align="absmiddle" />
	</div>
	<div class="ims">
		<?php if($manager->qq){ ?>
		<a href="http://wpa.qq.com/msgrd?V=1&amp;Uin=<?php echo $manager->qq; ?>&amp;Site=<?php echo urlencode(bone::get_config('system')->site_name); ?>&amp;Menu=yes" target="_blank">
		<img src="http://wpa.qq.com/pa?p=1:<?php echo $manager->qq; ?>:4" alt="QQ" border="0" height="16">
		</a>
		<?php } ?>
		
		<?php if($manager->wangwang){ ?>
		<a href="http://amos1.taobao.com/msg.ww?v=2&amp;uid=<?php echo urlencode($manager->wangwang); ?>&amp;s=2" target="_blank">
		<img src="http://amos1.taobao.com/online.ww?v=2&amp;uid=<?php echo urlencode($manager->wangwang); ?>&amp;s=2" alt="淘宝旺旺" border="0" width="16" height="16">
		</a>
		<?php } ?>
	</div>
	<div class="time"><?php echo date('Y-m-d H:i', $pricing->price_time); ?></div>
</div

><div class="pricing">
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr height="25">
	<th width="20"></th>
	<th align="left" width="200">项目</th>
	<th align="left" width="100">耗时</th>
	<th align="center">总计</th>
</tr>
<tr height="25" class="row-0">
	<td align="left"><a class="help" href="javascript:" title="工程师设计整个网站的框架结构， 数据库结构， 业务流程等。"></a></td>
	<td align="left">整体结构设计耗时</td>
	<td align="left">
	<?php
	if($pricing->time_structure>=3600) echo intval($pricing->time_structure/3600).'小时';
	if($pricing->time_structure%3600!=0) echo intval($pricing->time_structure%3600/60).'分钟';
	?>
	</td>
	<td rowspan="6" align="center" valign="middle">
	<?php
	if($pricing->time_total>=3600) echo intval($pricing->time_total/3600).'小时';
	if($pricing->time_total%3600!=0) echo intval($pricing->time_total%3600/60).'分钟';
	?>
	</td>
</tr>
<tr height="25" class="row-1">
	<td align="left"><a class="help" href="javascript:" title="页面布局效果图，由美术人员制作。如果您已设计好界面，将没有些项费用。"></a></td>
	<td align="left">页面设计耗时</td>
	<td align="left">
	<?php
	if($pricing->time_design>=3600) echo intval($pricing->time_design/3600).'小时';
	if($pricing->time_design%3600!=0) echo intval($pricing->time_design%3600/60).'分钟';
	?>
	</td>
</tr>
<tr height="25" class="row-0">
	<td align="left"><a class="help" href="javascript:" title="根据美工设计的布局效果图制作成相应的主题和模板。"></a></td>
	<td align="left">页面布局耗时</td>
	<td align="left">
	<?php
	if($pricing->time_layout>=3600) echo intval($pricing->time_layout/3600).'小时';
	if($pricing->time_layout%3600!=0) echo intval($pricing->time_layout%3600/60).'分钟';
	?>
	</td>
</tr>
<tr height="25" class="row-1">
  	<td align="left"><a class="help" href="javascript:" title="开发人员根据框架结构，界面设计， 实现具体的功能。"></a></td>
	<td align="left">程序开发耗时</td>
	<td align="left">
	<?php
	if($pricing->time_code>=3600) echo intval($pricing->time_code/3600).'小时';
	if($pricing->time_code%3600!=0) echo intval($pricing->time_code%3600/60).'分钟';
	?>
	</td>
</tr>
<tr height="25" class="row-0">
	<td align="left"><a class="help" href="javascript:" title="网站安全性功能，如防注入，防破解， 表单数据合法性检测等。"></a></td>
	<td align="left">安全设计耗时</td>
	<td align="left">
	<?php
	if($pricing->time_security>=3600) echo intval($pricing->time_security/3600).'小时';
	if($pricing->time_security%3600!=0) echo intval($pricing->time_security%3600/60).'分钟';
	?>
	</td>
</tr>
<tr height="25" class="row-1">
	<td align="left"><a class="help" href="javascript:" title="开发完成后，测试网站的各项工作是否正常，及时发现漏洞或不足并修复。"></a></td>
	<td align="left">测试耗时</td>
	<td align="left">
	<?php
	if($pricing->time_test>=3600) echo intval($pricing->time_test/3600).'小时';
	if($pricing->time_test%3600!=0) echo intval($pricing->time_test%3600/60).'分钟';
	?>
	</td>
</tr>
<tr height="25" class="row-0">
	<td align="left"></td>
	<td align="left"></td><td colspan="2" align="left"></td>
</tr>
<tr height="25" class="row-1">
	<td align="left">&nbsp;</td>
	<td align="left">工期</td><td colspan="2" align="left"><?php echo $pricing->estimate_days; ?>天</td>
</tr>
<tr height="25" class="row-0">
	<td align="left">&nbsp;</td>
	<td align="left">每小时费用</td><td colspan="2" align="left"><span class="required"><?php echo $pricing->hourly_rate; ?></span>元/小时</td>
</tr>
<tr height="25" class="row-1">
	<td align="left">&nbsp;</td>
	<td align="left">总计费用</td><td colspan="2" align="left"><?php
	if($pricing->time_total>=3600) echo intval($pricing->time_total/3600).'小时';
	if($pricing->time_total%3600!=0) echo intval($pricing->time_total%3600/60).'分钟';
	echo ' X '. $pricing->hourly_rate.'元/小时 =<span class="required" style="font-size:16px;">'.number_format($pricing->price, 2).'</span>元';
	?>
	</td>
</tr>
</table>
</div>
<?php
}
else
{
	echo '等待工程师报价...';
}
?>

</div>
		<?php
	}		
		

}
?>